﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace TouchPoint.Foundation
{
    public sealed class Deque<T> : ICollection<T>,IReadOnlyCollection<T>
    {
        T[] _array = Arrays<T>.Empty;

        int _length;
        int _capacity;
        int _tail,_head;

        #region Constructor

        public Deque() { }

        public Deque(int capacity)
        {
            _array = new T[capacity];
            _capacity = capacity;
            _length = 0;
            _tail = _head = 0;
        }

        public Deque(IEnumerable<T> enumerator)
        {

        }

        #endregion

        #region ICollection<T> 接口成员

        public int Count {
            get {
                return _length;
            }
        }

        public bool IsReadOnly {
            get {
                return false;
            }
        }


        public void Add(T item)
        {

        }

        public void Clear()
        {

        }

        public bool Contains(T item)
        {
            throw new NotImplementedException();
        }

        public void CopyTo(T[] array, int arrayIndex)
        {
            
        }

        public IEnumerator<T> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        public bool Remove(T item)
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            throw new NotImplementedException();
        }

        #endregion

        #region Method

        void SetCapacity(int capacity)
        {

        }

        #endregion

        public int Capacity {
            get {
                return _capacity;
            }
            set {
                if (value < 0 || value > int.MaxValue) {
                    throw new ArgumentOutOfRangeException();
                }
                if (_capacity < value) {
                    _capacity = value;
                }
            }
        }       
    }
}
